/**
 * Created by zzp on 2017/5/31 0031.
 */

(function ($) {

    $.ajax({
        url: "user/getMenu",
        type: "post",
        async: "false",
        data: { userid: localStorage.getItem("token")},
        success: function (msg) {
            var str="";
            $.each(msg,function(x,y){
               if(y.id=="11"){//投资
                   str+="<a href=\'invest.html\' class=\'weui-tabbar__item iconcheck\'>"
                   str+="        <div class=\'weui-tabbar__icon\'>"
                   str+="            <i class=\'iconfont icon-wodedingdan\'></i>"
                   str+="        </div>"
                   str+="        <p class=\'weui-tabbar__label\'>投资</p>"
                   str+="    </a>"
               }else if(y.id=="12"){//申请
                  // str+="<div style='position: relative'>"
                   str+="    <a href=\'approve.html\' class=\'weui-tabbar__item\'>"
                   str+="        <div class=\'weui-tabbar__icon\' <!--style=\'position: relative;\'-->>"
                   str+="            <i class=\'iconfont icon-edit\'></i>"
                   str+="        </div>"
                   str+="        <p class=\'weui-tabbar__label\'><span class=\'weui-badge\' id=\'pro_size1\'val=\'0\' style=\'position: absolute;    left: 3rem;bottom: 1.3rem;\'>0</span>申请</p>"
                   str+="    </a>"
                 //  str+="     </div>"
               }else if(y.id=="13"){//我的
                   str+="    <a href=\'user.html\' class=\'weui-tabbar__item\'>"
                   str+="        <div class=\'weui-tabbar__icon\'>"
                   str+="            <i class=\'iconfont icon-account\'></i>"
                   str+="        </div>"
                   str+="        <p class=\'weui-tabbar__label\'>我的</p>"
                   str+="    </a>"
               }

            });
            $(".weui-tabbar").append(str);
        }
    })
   /* var member_category = localStorage.getItem("member_category");
    if (member_category != null && member_category != '' && member_category != "undefined") {
        var str="";
        str+="<a href=\'touzi.html\' class=\'weui-tabbar__item iconcheck\'>"
        str+="        <div class=\'weui-tabbar__icon\'>"
        str+="            <i class=\'iconfont icon-wodedingdan\'></i>"
        str+="        </div>"
        str+="        <p class=\'weui-tabbar__label\'>投资</p>"
        str+="    </a>"
        if(member_category!=0){
            str+="    <a href=\'approve.html\' class=\'weui-tabbar__item\'>"
            str+="        <div class=\'weui-tabbar__icon\'>"
            str+="            <i class=\'iconfont icon-edit\'></i>"
            str+="        </div>"
            str+="        <p class=\'weui-tabbar__label\'><span class=\'weui-badge\' id=\'pro_size1\'val=\'0\' style=\'position: absolute;    left: 3rem;bottom: 1.1rem;\'>0</span>申请</p>"
            str+="    </a>"
        }
        str+="    <a href=\'user.html\' class=\'weui-tabbar__item\'>"
        str+="        <div class=\'weui-tabbar__icon\'>"
        str+="            <i class=\'iconfont icon-account\'></i>"
        str+="        </div>"
        str+="        <p class=\'weui-tabbar__label\'>我的</p>"
        str+="    </a>"

        $(".weui-tabbar").append(str);
    } else {
        $.toast("请登录");
        setTimeout(function() {
            window.location.href = "login.html";
        }, 1000);
    }*/
})(jQuery);
(function($) {
    var token = localStorage.getItem("token");
    var username = localStorage.getItem("username");
    if (token != null && username != null && token != "undefined") {
        $("#ligin_icon").append('<a href="#" class="icon pull-right">' + username + '</a>');
    } else {
        $("#ligin_icon").append('<a href="login.html" class="icon pull-right"><i class="iconfont icon-wode"></i></a>');
    }
    var s2=12.6
    circleProgress({
        id : 'productlist2',
        progress : s2, // default: 100
        duration : 2000, // default: 1000
        color : 'rgb(251, 137, 53)',
        bgColor : 'rgb(237, 237, 237)',
        textColor : '#fb8935',
        progressWidth : 0.05, // default: 0.25 (r)
        fontScale : 0.5, // default: 0.4 (r)
        toFixed : 1 // default: 0
    });
})(jQuery);
$(document.body).infinite().on("infinite", function() {
    if (loading) return;
    loading = true;
    setTimeout(function() {
        loadProData();
        loading = false;
    }, 500);
});
$(document.body).pullToRefresh().on('pull-to-refresh', function (done) {
    var self = this
    setTimeout(function() {
        $(document.body).pullToRefreshDone();
        $("#pro_div").html("");
        addupload();
        loadProData();
    }, 1000)
})
function pro_ship_cart() {
    if ($("#pro_size").attr("val") == 0) {
        $.toast("请先选择产品", "forbidden");
    } else {
        window.location.href = "touzishopping.html";
    }
}
